package qianfeng.com.meijiadaka.viewholder;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import cn.lemon.view.adapter.BaseViewHolder;
import qianfeng.com.meijiadaka.R;
import qianfeng.com.meijiadaka.adapter.IamgeTutorialAdapter;
import qianfeng.com.meijiadaka.bean.TutorialBean;

/**
 * Created by yanshihao on 2017/2/9.
 */

public class ImageViewHolder extends BaseViewHolder<TutorialBean.ResultBean> {

    private TextView tv1,tv2;
    private RecyclerView mRecyclerView;
    public ImageViewHolder(ViewGroup parent) {
        super(parent, R.layout.image_tutorial);
    }

    @Override
    public void onInitializeView() {
        super.onInitializeView();
        tv1=findViewById(R.id.image_tutorial_tv);
        tv2=findViewById(R.id.image_tutorial_title);
        mRecyclerView=findViewById(R.id.image_tutorial_rv);
    }

    @Override
    public void setData(TutorialBean.ResultBean object) {
        super.setData(object);
        tv2.setText("热门推荐");
        mRecyclerView.setLayoutManager(new GridLayoutManager(itemView.getContext(),2, LinearLayoutManager.VERTICAL,false));
        mRecyclerView.setAdapter(new IamgeTutorialAdapter(itemView.getContext(),object.getHotVideos()));
    }

    @Override
    public void onItemViewClick(TutorialBean.ResultBean object) {
        super.onItemViewClick(object);
    }
}
